<%--
  Created by IntelliJ IDEA.
  User: 刘邓
  Date: 2023-12-09
  Time: 17:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>增加学生信息</title>
    <link rel="stylesheet" type="text/css" href="/form.css" />
</head>
<body>
<form action="/user/add" class="container">

    <h2>添加学生信息</h2>

    <div class="form-group">

        <label for="username">学生名:</label>

        <input type="text" name="username" id="username" class="form-control">

    </div>

    <div class="form-group">

        <label for="account">学号:</label>

        <input type="text" name="account" id="account" class="form-control">

    </div>


    <div style="text-align: center">

        <button type="submit" id="toAdd" style="width: 100px;height: 50px;background-color: #fff" class="btn btn-primary">添加</button>

    </div>

</form>
<script>
    let toAdd = document.getElementById("toAdd");
    toAdd.addEventListener("click",(evt)=>{
        let username_str=document.getElementById("username").value;
        if(username_str===null||username_str===""){
            alert("请输入学生名");
            evt.preventDefault();
            return;
        }
        let account_str=document.getElementById("account").value;
        if(account_str===null||account_str===""){
            alert("请输入学号");
            evt.preventDefault();
            return;
        }
    })
</script>
</body>
</html>
